package com.study.mike.common.springboot.autoconfigurate;

import com.study.mike.common.MikeService;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: chenhs
 * @date: Created in 11:03 2019/12/20
 **/
@Configuration
@EnableConfigurationProperties(MyCommonProperties.class)
public class MyCommonAutoConfiguration {

    @Bean
    public MikeService commonService(MyCommonProperties mp) {
        MikeService cs = new MikeService();
        cs.setId(mp.getId());
        cs.setUsername(mp.getUsername());
        cs.setPassword(mp.getPassword());
        return cs;
    }


}
